import http from '../../utils/http'
const BASE_URL = 'http://192.168.221.234:8011';

//获取商品管理的初始化数据、搜索
// const getGoods = (obj) => http({
//     url: `${BASE_URL}/service_goods/getGoodsList`,
//     method: 'post',
//     data: { ...obj }
// })

//删除商品管理的数据
const delGoods = (goodsId) => http({
    url: `${BASE_URL}/service_goods/deleteGood`,
    method: 'get',
    params: { goodsId }
})

//下架商品管理的数据
const shelvesGoods = (goodsId) => http({
    url: `${BASE_URL}/service_goods/soldOut`,
    method: 'get',
    params: { goodsId }
})

//新增商品管理的数据
const addGoods = (obj) => http({
    url: `${BASE_URL}/service_goods/addGoods`,
    method: 'post',
    data: { ...obj }
})

//获取商品类别
const typeGoods = () => http({
    url: `${BASE_URL}/service_goods/getGoodsClass`,
    method: 'get',
    params: {}
})

//编辑商品管理的数据
const editGoods = (obj) => http({
    url: `${BASE_URL}/service_goods/editGood`,
    method: 'post',
    data: { ...obj }
})

//编辑时，查询单个商品的数据  
const getGoodData = (goodsId) => http({
    url: `${BASE_URL}/service_goods/getGood`,
    method: 'get',
    params: { goodsId }
})

export { getGoods, delGoods, shelvesGoods, addGoods, typeGoods, editGoods, getGoodData }